package com.kgcx.common.eum;

import com.kgcx.common.log.Log;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;

@Getter
@AllArgsConstructor
@Slf4j
public enum OrderCancelTypeEnum {

    PASSENGER(1, "乘客取消"),
    DRIVER(2, "司机取消"),
    ADMIN(3, "管理后台取消");

    private int code;

    private String message;

    public static OrderCancelTypeEnum getEnum(int code)
    {
        for(OrderCancelTypeEnum item: OrderCancelTypeEnum.values())
        {
            if(code == item.getCode())
            {
                return item;
            }
        }
        log.warn(Log.op("get OrderCancelTypeEnum").msg("code param is out of range").kv("code", code).toString());
        return null;
    }

}
